﻿<%@ Page Language="C#" MasterPageFile="~/Forum.master" AutoEventWireup="true" CodeBehind="LandingPage.aspx.cs" Inherits="Forums.LandingPage" %>
<%@ Register src="UserControls/SearchFunction.ascx" tagname="SearchFunction" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="searchContentHolder" runat="server">
    <uc1:SearchFunction ID="SearchFunction1" runat="server" />
    </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="mainContentHolder" runat="server">
    <asp:SqlDataSource ID="LandingPageGrid" runat="server" 
        ConnectionString="<%$ ConnectionStrings:CentForumsDB %>" SelectCommand="SELECT TOP 10
	topic.topic_id,
	topic.refers_to,
	thread.thread_subject AS Thread,
	topic.reply,
	topic.date_posted,
	thread.topic_id AS threadID
FROM 
	topic 
	--INNER JOIN registration ON topic.user_accnt = registration.user_accnt
	INNER JOIN topic AS Thread ON thread.topic_id = topic.refers_to
	AND thread.thread_subject IS NOT NULL	
ORDER BY topic.date_posted DESC"></asp:SqlDataSource>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="topic_id,threadID" DataSourceID="LandingPageGrid">
        <Columns>
            <asp:BoundField DataField="Thread" HeaderText="Topic" SortExpression="Thread" />
            <asp:BoundField DataField="reply" HeaderText="Post" SortExpression="reply" />
            <asp:BoundField DataField="date_posted" HeaderText="Date Posted" 
                SortExpression="date_posted" />
        </Columns>
    </asp:GridView>
    <br />
    <br />
    <br />
</asp:Content>
